using Assets.Scripts.GDK;
using UnityEngine;

namespace Brick
{
	public class RewardsAlert : gdk_base_alert_layer
	{
		public Transform content;

		public RewardItem[] rewardItems;

		private DayModel[] rewardInfos;

		public void OnData(DayModel[] daysInfo)
		{
			rewardInfos = daysInfo;
			rewardItems[0].gameObject.SetActive(value: false);
			rewardItems[1].gameObject.SetActive(value: false);
			rewardItems[2].gameObject.SetActive(value: false);
			for (int i = 0; i < daysInfo.Length && i < 3; i++)
			{
				DayModel dayModel = daysInfo[i];
				rewardItems[i].gameObject.SetActive(value: true);
				rewardItems[i].OnData(dayModel.rewardCount.ToString(), dayModel.rewardType);
			}
		}

		public void OnClick()
		{
			for (int i = 0; i < rewardInfos.Length && i < 3; i++)
			{
				DayModel dayModel = rewardInfos[i];
				GDK.ModuleManger.Module<GameSceneModule>().OnGainTools(dayModel.rewardType, dayModel.rewardCount);
			}
			close();
		}
	}
}

